/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cpasl;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;

/**
 *
 * @author seanm_000
 */
public class ExposureGridPane extends GridPane {
    
    public ExposureGridPane() {
        setAlignment(Pos.CENTER);
        setHgap(15);
        setVgap(15);
        
        Label exposureLabel = new Label("What exposure have you had to ASL?");
        final ToggleGroup exposureGroup = new ToggleGroup();
        RadioButton noneButton = new RadioButton("None or alphabet only");
        noneButton.setUserData("A");
        noneButton.setToggleGroup(exposureGroup);
        noneButton.setSelected(true);
        RadioButton beginningButton = new RadioButton("Beginning Signer");
        beginningButton.setUserData("B");
        beginningButton.setToggleGroup(exposureGroup);
        RadioButton intermediateButton = new RadioButton("Intermediate Signer");
        intermediateButton.setUserData("C");
        intermediateButton.setToggleGroup(exposureGroup);
        RadioButton advancedButton = new RadioButton("Advanced signer / Fluent signer");
        advancedButton.setUserData("D");
        advancedButton.setToggleGroup(exposureGroup);
        
        Button nextButton = new Button();
        nextButton.setText("Next");
        nextButton.setId("next-button");
        nextButton.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                String userData = (String) ((RadioButton) exposureGroup.getSelectedToggle()).getUserData();
                CpaslManager.getInstance().setExposureToAsl(userData);
                if (userData.equals("A")) { //No sign langualge experience, so no need for ASL_START.
                    CpaslManager.getInstance().setStartAgeAsl("A");
                    CpaslManager.getInstance().switchToDisplay(Groups.ASL_FREQUENCY, 0);
                }
                else {
                    CpaslManager.getInstance().switchToDisplay(Groups.ASL_START, 0);
                }
            }
        });
        
        add(exposureLabel, 0, 0);
        add(noneButton, 0, 1);
        add(beginningButton, 0, 2);
        add(intermediateButton, 0, 3);
        add(advancedButton, 0, 4);
        add(nextButton, 0, 5);
    }
    
}
